﻿<?php
session_start();
echo '<body bgcolor="#009900"><center><h2>删除文件</h2>';
if(isset($_SESSION["user"])==false){
	header("location:../login.php");
	exit;
}
$user=$_SESSION["user"];
if(isset($_SESSION["dir"])==false){
	header("location:index.php");
	exit;
}
$dir=$_SESSION["dir"];
$name=$_POST["name"];
$name=str_ireplace("..","isnot",$name);
$name=str_ireplace(";","isnot",$name);
unlink("$user/$dir/$name");

$file=fopen("../log.txt","a");
include '../lib/time.php';
fwrite($file,"\r\n" . $time . ":'$user' in '$dir' delete the file '$name'.");


header("location:index.php?dir=$dir");
exit;
?>